home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-11 | 10.5 KB | 592 lines | [TEXT/MPS ] |
- ;
- ; File: Power.a
- ;
- ; Copyright: © 1984-1994 by Apple Computer, Inc.
- ; All rights reserved.
- ;
- ; Version: Universal Interfaces 2.0a3 ETO #16, MPW prerelease. Friday, November 11, 1994.
- ;
- ; Bugs?: If you find a problem with this file, send the file and version
- ; information (from above) and the problem description to:
- ;
- ; Internet: apple.bugs@applelink.apple.com
- ; AppleLink: APPLE.BUGS
- ;
- ;
-
- IF &TYPE('__POWER__') = 'UNDEFINED' THEN
- __POWER__ SET 1
-
-
- IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
- include 'Types.a'
- ENDIF
- ; include 'ConditionalMacros.a' ;
-
- IF &TYPE('__MIXEDMODE__') = 'UNDEFINED' THEN
- include 'MixedMode.a'
- ENDIF
-
- ; Bit positions for ModemByte
- modemOnBit EQU 0
- ringWakeUpBit EQU 2
- modemInstalledBit EQU 3
- ringDetectBit EQU 4
- modemOnHookBit EQU 5
- ; masks for ModemByte
- modemOnMask EQU $1
- ringWakeUpMask EQU $4
- modemInstalledMask EQU $8
- ringDetectMask EQU $10
- modemOnHookMask EQU $20
- ; bit positions for BatteryByte
- chargerConnBit EQU 0
- hiChargeBit EQU 1
- chargeOverFlowBit EQU 2
- batteryDeadBit EQU 3
- batteryLowBit EQU 4
- connChangedBit EQU 5
- ; masks for BatteryByte
- chargerConnMask EQU $1
- hiChargeMask EQU $2
- chargeOverFlowMask EQU $4
- batteryDeadMask EQU $8
-
- batteryLowMask EQU $10
- connChangedMask EQU $20
- ; commands to SleepQRec sleepQProc
- sleepRequest EQU 1
- sleepDemand EQU 2
- sleepWakeUp EQU 3
- sleepRevoke EQU 4
- ; SleepQRec.sleepQFlags
- noCalls EQU 1
- noRequest EQU 2
- slpQType EQU 16
- sleepQType EQU 16
-
- ; bits in bitfield returned by PMFeatures
- hasWakeupTimer EQU 0 ; 1=wakeup timer is supported
- hasSharedModemPort EQU 1 ; 1=modem port shared by SCC and internal modem
- hasProcessorCycling EQU 2 ; 1=processor cycling is supported
- mustProcessorCycle EQU 3 ; 1=processor cycling should not be turned off
- hasReducedSpeed EQU 4 ; 1=processor can be started up at reduced speed
- dynamicSpeedChange EQU 5 ; 1=processor speed can be switched dynamically
- hasSCSIDiskMode EQU 6 ; 1=SCSI Disk Mode is supported
- canGetBatteryTime EQU 7 ; 1=battery time can be calculated
- canWakeupOnRing EQU 8 ; 1=can wakeup when the modem detects a ring
- hasDimmingSupport EQU 9 ; 1 has dimming support built into the rom
-
- ; bits in bitfield returned by GetIntModemInfo and set by SetIntModemState
- hasInternalModem EQU 0 ; 1=internal modem installed
- intModemRingDetect EQU 1 ; 1=internal modem has detected a ring
- intModemOffHook EQU 2 ; 1=internal modem is off hook
- intModemRingWakeEnb EQU 3 ; 1=wakeup on ring is enabled
- extModemSelected EQU 4 ; 1=external modem selected
- modemSetBit EQU 15 ; 1=set bit, 0=clear bit (SetIntModemState)
-
- ; bits in BatteryInfo.flags
- ; ("chargerConnected" doesn't mean the charger is plugged in)
- batteryInstalled EQU 7 ; 1=battery is currently connected
- batteryCharging EQU 6 ; 1=battery is being charged
- chargerConnected EQU 5 ; 1=charger is connected to the PowerBook
-
- HDPwrQType EQU 'HD'
-
- BatteryInfo RECORD 0
- flags ds.b 1 ; misc flags (see below)
- warningLevel ds.b 1 ; scaled warning level (0-255)
- reserved ds.b 1 ; reserved for internal use
- batteryLevel ds.b 1 ; scaled battery level (0-255)
- sizeof EQU 4
- ENDR
-
- HDQueueElement RECORD 0
- hdQLink ds.l 1 ; pointer to next queue element
- hdQType ds.w 1 ; queue element type (must be HDQType)
- hdFlags ds.w 1 ; miscellaneous flags
- hdProc ds.l 1 ; pointer to routine to call
- hdUser ds.l 1 ; user-defined (variable storage, etc.)
- sizeof EQU 16
- ENDR
-
- SleepQRec RECORD 0
- sleepQLink ds.l 1
- sleepQType ds.w 1 ; type = 16
- sleepQProc ds.l 1 ; Pointer to sleep universal proc ptr
- sleepQFlags ds.w 1
- sizeof EQU 12
- ENDR
-
- ; wakeup time record
- WakeupTime RECORD 0
- wakeTime ds.l 1 ; wakeup time (same format as current time)
- wakeEnabled ds.b 1 ; 1=enable wakeup timer, 0=disable wakeup timer
- filler ds.b 1
- sizeof EQU 6
- ENDR
-
- ; battery time information (in seconds)
- BatteryTimeRec RECORD 0
- expectedBatteryTime ds.l 1 ; estimated battery time remaining
- minimumBatteryTime ds.l 1 ; minimum battery time remaining
- maximumBatteryTime ds.l 1 ; maximum battery time remaining
- timeUntilCharged ds.l 1 ; time until battery is fully charged
- sizeof EQU 16
- ENDR
-
- IF GENERATING68K THEN
- _IdleUpdate: OPWORD $A285
- ELSE
- IMPORT IdleUpdate
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _GetCPUSpeed
- dc.w $70FF
- dc.w $A485
- EndM
- ELSE
- IMPORT GetCPUSpeed
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _EnableIdle
- moveq #0,d0
- dc.w $A485
- EndM
- ELSE
- IMPORT EnableIdle
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _DisableIdle
- moveq #1,d0
- dc.w $A485
- EndM
- ELSE
- IMPORT DisableIdle
- ENDIF
-
- IF GENERATING68K THEN
- _SleepQInstall: OPWORD $A28A
- ELSE
- IMPORT SleepQInstall
- ENDIF
-
- IF GENERATING68K THEN
- _SleepQRemove: OPWORD $A48A
- ELSE
- IMPORT SleepQRemove
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _AOn
- moveq #4,d0
- dc.w $A685
- EndM
- ELSE
- IMPORT AOn
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _AOnIgnoreModem
- moveq #5,d0
- dc.w $A685
- EndM
- ELSE
- IMPORT AOnIgnoreModem
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _BOn
- moveq #0,d0
- dc.w $A685
- EndM
- ELSE
- IMPORT BOn
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _AOff
- dc.w $7084
- dc.w $A685
- EndM
- ELSE
- IMPORT AOff
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _BOff
- dc.w $7080
- dc.w $A685
- EndM
- ELSE
- IMPORT BOff
- ENDIF
-
- ; Public Power Management API (NEW!)
- IF GENERATING68K THEN
- Macro
- _PMSelectorCount
- moveq #0,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT PMSelectorCount
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _PMFeatures
- moveq #1,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT PMFeatures
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _GetSleepTimeout
- moveq #2,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT GetSleepTimeout
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _SetSleepTimeout
- dc.w $4840
- move.w #$0003,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT SetSleepTimeout
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _GetHardDiskTimeout
- moveq #4,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT GetHardDiskTimeout
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _SetHardDiskTimeout
- dc.w $4840
- move.w #$0005,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT SetHardDiskTimeout
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _HardDiskPowered
- moveq #6,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT HardDiskPowered
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _SpinDownHardDisk
- moveq #7,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT SpinDownHardDisk
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _IsSpindownDisabled
- moveq #8,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT IsSpindownDisabled
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _SetSpindownDisable
- dc.w $4840
- move.w #$0009,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT SetSpindownDisable
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _HardDiskQInstall
- moveq #10,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT HardDiskQInstall
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _HardDiskQRemove
- moveq #11,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT HardDiskQRemove
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _GetScaledBatteryInfo
- dc.w $4840
- move.w #$000C,d0
- dc.w $A09E
- dc.w $2080
- EndM
- ELSE
- IMPORT GetScaledBatteryInfo
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _AutoSleepControl
- dc.w $4840
- move.w #$000D,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT AutoSleepControl
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _GetIntModemInfo
- moveq #14,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT GetIntModemInfo
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _SetIntModemState
- dc.w $4840
- move.w #$000F,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT SetIntModemState
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _MaximumProcessorSpeed
- moveq #16,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT MaximumProcessorSpeed
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _CurrentProcessorSpeed
- moveq #17,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT CurrentProcessorSpeed
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _FullProcessorSpeed
- moveq #18,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT FullProcessorSpeed
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _SetProcessorSpeed
- dc.w $4840
- move.w #$0013,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT SetProcessorSpeed
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _GetSCSIDiskModeAddress
- moveq #20,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT GetSCSIDiskModeAddress
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _SetSCSIDiskModeAddress
- dc.w $4840
- move.w #$0015,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT SetSCSIDiskModeAddress
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _GetWakeupTimer
- moveq #22,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT GetWakeupTimer
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _SetWakeupTimer
- moveq #23,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT SetWakeupTimer
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _IsProcessorCyclingEnabled
- moveq #24,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT IsProcessorCyclingEnabled
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _EnableProcessorCycling
- dc.w $4840
- move.w #$0019,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT EnableProcessorCycling
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _BatteryCount
- moveq #26,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT BatteryCount
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _GetBatteryVoltage
- dc.w $4840
- move.w #$001B,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT GetBatteryVoltage
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _GetBatteryTimes
- dc.w $4840
- move.w #$001C,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT GetBatteryTimes
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _GetDimmingTimeout
- moveq #29,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT GetDimmingTimeout
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _SetDimmingTimeout
- dc.w $4840
- move.w #$001E,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT SetDimmingTimeout
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _DimmingControl
- dc.w $4840
- move.w #$001F,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT DimmingControl
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _IsDimmingControlDisabled
- moveq #32,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT IsDimmingControlDisabled
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _IsAutoSlpControlDisabled
- moveq #33,d0
- dc.w $A09E
- EndM
- ELSE
- IMPORT IsAutoSlpControlDisabled
- ENDIF
-
- ENDIF ; __POWER__
-